import { App } from "../../App";
import { ViewId } from "../../frame/common/view/IView";
import { IModule } from "../IModule";
import { CommonMultiCtrl } from "./CommonMultiCtrl";
import { DemoPageCtrl } from "./DemoPageCtrl";
import { DemoveViewConfig } from "./DemoViewConfig";



export class DemoModule implements IModule {

    private static _ins: DemoModule;
    static get ins(): DemoModule {
        if (!this._ins) {
            this._ins = new DemoModule();
        }
        return this._ins;
    }
    private constructor() {
    }

    model: any;
    util: any;

    init(): void {
        /** */
        App.ins.viewMgr.register(
            ViewId.DEMO_FIRST_MULTI,
            new CommonMultiCtrl(DemoveViewConfig.firstMulti, null),
            null
        )

        App.ins.viewMgr.register(
            ViewId.DEMO_FIRST_1,
            new DemoPageCtrl(DemoveViewConfig.first1, null),
            null
        )

        App.ins.viewMgr.register(
            ViewId.DEMO_FIRST_2,
            new DemoPageCtrl(DemoveViewConfig.first2, null),
            null
        )

        App.ins.viewMgr.register(
            ViewId.DEMO_FIRST_3,
            new DemoPageCtrl(DemoveViewConfig.first3, null),
            null
        )

        App.ins.viewMgr.registerTree(ViewId.DEMO_FIRST_MULTI, [ViewId.DEMO_FIRST_1, ViewId.DEMO_FIRST_2, ViewId.DEMO_FIRST_3, ViewId.DEMO_SECOND_MULTI]);

        /** */
        App.ins.viewMgr.register(
            ViewId.DEMO_SECOND_MULTI,
            new CommonMultiCtrl(DemoveViewConfig.secondMulti, null),
            null
        )

        App.ins.viewMgr.register(
            ViewId.DEMO_SECOND_1,
            new DemoPageCtrl(DemoveViewConfig.second1, null),
            null
        )

        App.ins.viewMgr.register(
            ViewId.DEMO_SECOND_2,
            new DemoPageCtrl(DemoveViewConfig.second2, null),
            null
        )

        App.ins.viewMgr.registerTree(ViewId.DEMO_SECOND_MULTI, [ViewId.DEMO_SECOND_1, ViewId.DEMO_SECOND_2, ViewId.DEMO_THIRD_MULTI]);

        /** */
        App.ins.viewMgr.register(
            ViewId.DEMO_THIRD_MULTI,
            new CommonMultiCtrl(DemoveViewConfig.thirdMulti, null),
            null
        )

        App.ins.viewMgr.register(
            ViewId.DEMO_THIRD_1,
            new DemoPageCtrl(DemoveViewConfig.third1, null),
            null
        )

        App.ins.viewMgr.register(
            ViewId.DEMO_THIRD_2,
            new DemoPageCtrl(DemoveViewConfig.third2, null),
            null
        )

        App.ins.viewMgr.register(
            ViewId.DEMO_THIRD_3,
            new DemoPageCtrl(DemoveViewConfig.third3, null),
            null
        )

        App.ins.viewMgr.registerTree(ViewId.DEMO_THIRD_MULTI, [ViewId.DEMO_THIRD_1, ViewId.DEMO_THIRD_2, ViewId.DEMO_THIRD_3]);


    }

    finit(): void {

    }
}
App.ins.moduleMgr.register(DemoModule.ins)